<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE HTML>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<base href="<%=basePath%>">
<html lang="zn-cn">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<title>上传图片素材</title>
</head>
<body>
	<div>
		<form method="post" action="infoQuery/uploadImage" id="dataForm" enctype="multipart/form-data">
			<p>
				<label for="file">上传：</label>
				<input type="file" id="file" name="file" class="file" style="width:200px;" />
				<input type="button" id="upload" value="上传"/>
				<div>
					<span id="resultMsg"></span>
					<span id="media_id"></span>
					<span id="url"></span>
				</div>
			</p>
	    </form>
	</div>
	
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript">
		$(function () {
			
			var actionResult = '${actionResult}';
			if(actionResult != '') {
				$('#resultMsg').text('${resultMsg}');
			}
			if(actionResult == 'success') {
				$('#media_id').text('media_id:' + '${media_id}');
				$('#url').text('url:' + '${url}');
			}
			
			$("#upload").on('click', function(e) {
				if($('#file').val() != '') {
					$("#dataForm").submit();
				} 
			});
			
		});
	
	</script>
</body>
</html>
